const prefix = '/api';
const suffix = '.do';

const urlMap = {
   'dev': {
      '登录': '/sign',
      '退出登录': '/signout',
      '注册': '/signup',
      '发送手机验证码': '/sendSmsCode',
      '实名认证': '/doIdCardAuth',
      '用户详情': '/whiteHatUserDetail',
      '忘记密码':'/resetLoginPw',
      '验证码登录':'/signByVerifyCode',
      '项目列表':'/vulnerabilityProjectList',
      '项目详情':'/vulnerabilityProjectDetail',
      '项目详情(未登录)':'/vulnerabilityProjectDetailNotLogin',
      '获取漏洞类型':'/getBugTypeNextLevel',
      '获取白帽项目列表(用于选择框)':'/vulnerabilityProjectParticipantListForOption',
      '企业信息列表(用户选择框)':'/firmUserListForOption',
      '漏洞类型表(用于选择框)':'/vulnerabilityTypeListForOption',
      '白帽参与项目':'/vulnerabilityProjectParticipant',
      '我的漏洞列表':'/bugList',
      '提交漏洞':'/commitBug',
      '公告列表':'/noticeForList',
      '公告详情':'/noticeDetail',
      '漏洞详情':'/bugDetail',
      '我的项目列表':'/vulnerabilityProjectParticipantList',
      '未读消息数':'/unreadNoticeCount',
   }
};

export const urlService = (type: string, key: string) => {
   const url = urlMap[type][key];
   if (url) {
      return prefix + urlMap[type][key] + suffix;
   } else {
      throw Error(`fail to find url: ${key}`);
   }
};

